import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import { _HttpClient } from '@delon/theme';


@Injectable({
  providedIn: 'root'
})
export class ShopService {

  constructor(private http: _HttpClient) { }

  // 编辑
  edit(data: any): Observable<any> {
    const url = "/microprogram/shop";
    return this.http.put(url, data);
  }

  // 查询店铺信息
  queryById(): Observable<any> {
    const url = "/microprogram/shop";
    return this.http.get(url); 
  }

  // 查询店铺列表
  queryShopList(): Observable<any> {
    const url = "/user/shops";
    return this.http.get(url); 
  }

  // 选择店铺
  selectShop(shopId: any): Observable<any> {
    const url = "/microprogram/chooseBrowsedShop?shopId=" + shopId;
    return this.http.post(url); 
  }

  // 查询店主信息
  getOwnerInfo(): Observable<any> {
    const url = "/user/getloginOnUser";
    return this.http.get(url); 
  }

  // 查询退换货规则列表
  queryReturnedRuleList(): Observable<any> {
    const url = "/aftersaleConf/list?pageStart=1&pageSize=20";
    return this.http.get(url); 
  }

  deleteReturnedRule(id: any): Observable<any> {
    const url = "/aftersaleConf/del/" + id + "/1";
    return this.http.get(url); 
  }

  createOrEditReturnedRule(data: any): Observable<any> {
    const url = "/aftersaleConf/save";
    return this.http.post(url, data); 
  }

  getFareInfo(): Observable<any> {
    const url = "/freight";
    return this.http.get(url); 
  }

  edit4Fare(data: any): Observable<any> {
    const url = "/freight/save";
    return this.http.post(url, data);
  }
  
}
